using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Admin_Controls_AddUser : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ddlType.DataSource = Enum.GetValues(typeof(DD.Users.UserType));
        ddlType.DataBind();
        


    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        DD.Users.User user = new DD.Users.User();
        user.FirstName = txtFirstName.Text;
        user.LastName = txtLastName.Text;
        user.Address = txtAddr1.Text;
        user.Address2 = txtAddr2.Text;
        user.City = txtCity.Text;
        user.State = txtState.Text;
        user.Email = txtEmail.Text;
        user.Phone = txtPhone.Text;
        try
        {
            user.Zip = Convert.ToInt32(txtZip.Text);
        }
        catch
        {
        }
        user.Username = txtUsername.Text;
        user.UserType = (DD.Users.UserType)Enum.Parse(typeof(DD.Users.UserType), ddlType.SelectedValue.ToString());
        DD.Users.UserManager.AddUser(user, txtPass1.Text);
    }

    
}
